<!--
Copyright 2018 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================
-->

<html>

<head>
  <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.min.css" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/6.0.0/normalize.min.css">
  <style>
    body {
      margin: 40px;
    }

    .row {
      display: flex;
      flex-direction: row;
      width: inherit;
      justify-content: space-between;
    }

    .col {
      display: flex;
      flex-direction: column;
    }

    .desc,
    .controls {
      padding: 10px;
      max-width: 400px;
    }

    .controls input[type="radio"] {
      margin-right: 2px;
    }

    .controls label {
      margin-right: 15px;
    }

    #vis {
      width: 100%;
      min-height: 100px;
      margin-left: 50px;
    }

    button {
      margin-bottom: 20px;
      font-size: 140%;
    }

    canvas {
      border: 1px solid black;
    }
  </style>
</head>

<body>
  <div class="row">
    <div class="col">
      <div class="desc">
        <h1>GPU Accelerated T-SNE in the Browser</h1>
        <p>
          This example demonstrates using
          <a href="https://github.com/tensorflow/tfjs-tsne">tfjs-tsne</a> to do dimensionality reduction on the
          <a href="https://en.wikipedia.org/wiki/MNIST_database">MNIST data set</a>. Here we take 10000 images of
          digits, resize them to 10x10px and use T-SNE to organize them
          in two dimensions.
        </p>
        <p>See the
          <a href="https://arxiv.org/abs/1805.10817">the paper</a> for more details, and check out the code for this
          example
          <a href="https://github.com/tensorflow/tfjs-examples/tree/master/tsne-mnist-canvas">here.</a>
        </p>
      </div>
      <div class="controls">
        <div>
          <button id='start' disabled>Start T-SNE</button>
        </div>

        <div>
          <label>Perplexity</label>
          <br>
          <span class='value-disp'>30</span>
          <input id="perplexity-input" type="range" min="2" max="42" value="30" step="1"></input>
        </div>

        <div>
          <label>KNN Iterations</label>
          <br>
          <span class='value-disp'>800</span>
          <input id="knn-input" type="range" min="2" max="1500" value="800" step="1"></input>
        </div>

        <div>
          <label>T-SNE Iterations</label>
          <br>
          <span class='value-disp'>500</span>
          <input id="tsne-input" type="range" min="1" max="1000" value="500" step="1"></input>
        </div>

        <div>
          <label>
            Number of Digits (dataset size)
          </label>
          <br>

          <input type="radio" id="small" name="numPoints" value="500">
          <label for="small">500 Digits</label>

          <input type="radio" id="medium" name="numPoints" value="2000">
          <label for="medium">2000 Digits</label>

          <input type="radio" id="large" name="numPoints" value="10000" checked>
          <label for="large">10000 Digits</label>
        </div>
      </div>
    </div>

    <div id="vis"></div>
  </div>



  <script src="./index.js"></script>
</body>

</html>
